#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "controlfireradar.h"
#include "device.h"
#include <QDebug>
MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    //1、生成3个设备
    Device *send_device=new ControlFireRadar;
    Device *recv_device_1=new ControlFireRadar;
    Device *recv_device_2=new ControlFireRadar;

    //2、第一个send_device设备的信号连接后面两个recv_device_1，recv_device_2的槽
    QVector<Device *>device_list;
    device_list.push_back(recv_device_1);
    device_list.push_back(recv_device_2);
    for(const auto &it:device_list)
      {
          connect(send_device,&Device::sendDataToOtherDevice,it,&Device::onOtherDevice);
      }

    //3、第一个设备发信号
    send_device->doWork();


    //4、输出结果，后面两个设备都收到信号，并打印

}

MainWindow::~MainWindow()
{
    delete ui;
}

